﻿using MediatR;
using RBAC.LuFang.API.Application.Command.heathCommand;
using RBAC.LuFang.Domain.Traceability;
using RBAC.LuFang.Domin.Services.TraceabilityService;

namespace RBAC.LuFang.API.Application.CommandHandlers.heathCommandhandler
{
    //添加保健信息
    public class heathCreateCommandHandler:IRequestHandler<heathCreateCommand,int>
    {
        private readonly IGoodsService _goodsService;

        public heathCreateCommandHandler(IGoodsService goodsService)
        {
            _goodsService = goodsService;
        }

        public async Task<int> Handle(heathCreateCommand request, CancellationToken cancellationToken)
        {
            var heathModel=new health() { healthid=request.healthid, healthDay=request.healthDay, healthName = request.healthName, healthType =request.healthType , goodsId =request.goodsId };
            return await _goodsService.Addhealth(heathModel);
        }
    }
}
